home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / binutils.252 / gas / subsegs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-21  |  4.3 KB  |  138 lines

  1. /* subsegs.h -> subsegs.c
  2.  
  3.    Copyright (C) 1987, 1992, 1993, 1994 Free Software Foundation, Inc.
  4.  
  5.    This file is part of GAS, the GNU Assembler.
  6.  
  7.    GAS is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 2, or (at your option)
  10.    any later version.
  11.  
  12.    GAS is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with GAS; see the file COPYING.  If not, write to
  19.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /*
  22.  * For every sub-segment the user mentions in the ASsembler program,
  23.  * we make one struct frchain. Each sub-segment has exactly one struct frchain
  24.  * and vice versa.
  25.  *
  26.  * Struct frchain's are forward chained (in ascending order of sub-segment
  27.  * code number). The chain runs through frch_next of each subsegment.
  28.  * This makes it hard to find a subsegment's frags
  29.  * if programmer uses a lot of them. Most programs only use text0 and
  30.  * data0, so they don't suffer. At least this way:
  31.  * (1)    There are no "arbitrary" restrictions on how many subsegments
  32.  *    can be programmed;
  33.  * (2)    Subsegments' frchain-s are (later) chained together in the order in
  34.  *    which they are emitted for object file viz text then data.
  35.  *
  36.  * From each struct frchain dangles a chain of struct frags. The frags
  37.  * represent code fragments, for that sub-segment, forward chained.
  38.  */
  39.  
  40. struct frchain            /* control building of a frag chain */
  41. {                /* FRCH = FRagment CHain control */
  42.   struct frag *frch_root;    /* 1st struct frag in chain, or NULL */
  43.   struct frag *frch_last;    /* last struct frag in chain, or NULL */
  44.   struct frchain *frch_next;    /* next in chain of struct frchain-s */
  45.   segT frch_seg;        /* SEG_TEXT or SEG_DATA. */
  46.   subsegT frch_subseg;        /* subsegment number of this chain */
  47. #ifdef BFD_ASSEMBLER
  48.   fixS *fix_root;        /* Root of fixups for this subsegment.  */
  49.   fixS *fix_tail;        /* Last fixup for this subsegment.  */
  50. #endif
  51. };
  52.  
  53. typedef struct frchain frchainS;
  54.  
  55. /* All subsegments' chains hang off here.  NULL means no frchains yet.  */
  56. extern frchainS *frchain_root;
  57.  
  58. /* Frchain we are assembling into now That is, the current segment's
  59.    frag chain, even if it contains no (complete) frags. */
  60. extern frchainS *frchain_now;
  61.  
  62.  
  63. typedef struct
  64. {
  65.   frchainS *frchainP;
  66.   int hadone : 1;
  67.  
  68.   /* This field is set if this is a .bss section which does not really
  69.      have any contents.  Once upon a time a .bss section did not have
  70.      any frags, but that is no longer true.  This field prevent the
  71.      SEC_HAS_CONTENTS flag from being set for the section even if
  72.      there are frags.  */
  73.   int bss : 1;
  74.  
  75.   int user_stuff;
  76.  
  77.   /* Fixups for this segment.  If BFD_ASSEMBLER, this is only valid
  78.      after the frchains are run together.  */
  79.   fixS *fix_root;
  80.   fixS *fix_tail;
  81.  
  82. #if defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
  83.   struct internal_scnhdr scnhdr;
  84. #endif
  85.   symbolS *dot;
  86.  
  87.   struct lineno_list *lineno_list_head;
  88.   struct lineno_list *lineno_list_tail;
  89.  
  90. #ifdef BFD_ASSEMBLER
  91.   /* Which BFD section does this gas segment correspond to?  */
  92.   asection *bfd_section;
  93.  
  94.   /* NULL, or pointer to the gas symbol that is the section symbol for
  95.      this section.  sym->bsym and bfd_section->symbol should be the same.  */
  96.   symbolS *sym;
  97. #endif
  98.  
  99.   union
  100.     {
  101.       /* Current size of section holding stabs strings.  */
  102.       unsigned long stab_string_size;
  103.       /* Initial frag for ELF.  */
  104.       char *p;
  105.     }
  106.   stabu;
  107.  
  108. #ifdef NEED_LITERAL_POOL
  109.   unsigned long literal_pool_size;
  110. #endif
  111. } segment_info_type;
  112.  
  113. #ifdef BFD_ASSEMBLER
  114.  
  115. extern segment_info_type *seg_info PARAMS ((segT));
  116. extern symbolS *section_symbol PARAMS ((segT));
  117.  
  118. #else /* ! BFD_ASSEMBLER */
  119.  
  120. #ifdef MANY_SEGMENTS
  121.  
  122. extern segment_info_type segment_info[];
  123.  
  124. #define seg_info(SEC)    (&segment_info[SEC])
  125.  
  126. #else
  127.  
  128. /* Sentinel for frchain crawling.  Points to the 1st data-segment
  129.    frchain.  (Which is pointed to by the last text-segment frchain.) */
  130. extern frchainS *data0_frchainP;
  131. extern frchainS *bss0_frchainP;
  132.  
  133. #endif
  134.  
  135. #endif /* ! BFD_ASSEMBLER */
  136.  
  137. /* end of subsegs.h */
  138.